package marchsoft.modules.four.admin.controller;


import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import marchsoft.base.PageVO;
import marchsoft.modules.four.common.entity.Slideshow;
import marchsoft.modules.four.admin.service.SlideshowService;
import marchsoft.response.Result;
import org.springframework.web.bind.annotation.*;

import java.util.List;


@RestController
@RequiredArgsConstructor
@Api(tags = "后台：轮播图管理")
@RequestMapping("/api/eSlideshow")
public class SlideshowController {

    private final SlideshowService slideshowService;



    @ApiOperation("新增轮播图")
    @PostMapping
    public Result<Object> save(@RequestBody Slideshow slideshow) {
        slideshowService.saveSlide(slideshow);
        return Result.success();

    }
    @ApiOperation("更新轮播图")
    @PutMapping
    public Result<Object> update(@RequestBody Slideshow slideshow){
        slideshowService.update(slideshow);
        return Result.success();

    }


    @ApiOperation("删除轮播图")
    @DeleteMapping
    public Result<Object> delSlide(@RequestBody List<Integer> ids){
        slideshowService.delete(ids);
        return Result.success();
    }

    @ApiOperation("分页查询")
    @GetMapping("/all")
    public Result<Object> findPage1(PageVO pageVO) {
        return Result.success(slideshowService.queryAll1(pageVO));
    }










}
